package cn.servlet;

import cn.dao.StaffDao;
import cn.dao.StaffDaoImpl;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/delete")
public class DeleteServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req,
                           HttpServletResponse resp)
            throws IOException {
        int id = Integer.parseInt(req.getParameter("id"));
        StaffDao dao = new StaffDaoImpl();
        dao.deleteId(id);
        resp.sendRedirect("staff_list");
    }
}
